package net.NingXiaRuiTai.ShortChain.service;

import net.NingXiaRuiTai.ShortChain.controller.request.ShortLinkAddRequest;
import net.NingXiaRuiTai.ShortChain.controller.request.ShortLinkDelRequest;
import net.NingXiaRuiTai.ShortChain.controller.request.ShortLinkPageRequest;
import net.NingXiaRuiTai.ShortChain.controller.request.ShortLinkUpdateRequest;
import net.NingXiaRuiTai.ShortChain.model.EventMessage;
import net.NingXiaRuiTai.ShortChain.model.ShortLinkDO;
import com.baomidou.mybatisplus.extension.service.IService;
import net.NingXiaRuiTai.ShortChain.model.VO.ShortLinkVO;
import net.NingXiaRuiTai.ShortChain.utils.JsonData;

import java.util.Map;

/**
 * <p>
 * 服务类
 * </p>
 *
 * @author Yuan
 * @since 2025-02-16
 */
public interface ShortLinkService extends IService<ShortLinkDO> {
    /**
     * 解析短链
     *
     * @param shortLinkCode
     * @return
     */
    ShortLinkVO parseShortLinkCode(String shortLinkCode);

    /**
     * 创建短链
     *
     * @param addRequest
     * @return
     */
    JsonData creatShortLink(ShortLinkAddRequest addRequest);


    /**
     * 处理新增短链消息
     *
     * @param eventMessage
     * @return
     */
    boolean handAddShortLink(EventMessage eventMessage);

    /**
     * 分页查找
     *
     * @param request
     * @return
     */
    Map<String, Object> pageByGroupId(ShortLinkPageRequest request);

    JsonData delShortLink(ShortLinkDelRequest delRequest);

    JsonData updateShortLink(ShortLinkUpdateRequest updateRequest);

    boolean handDelShortLink(EventMessage eventMessage);

    boolean handUpdateShortLink(EventMessage eventMessage);
}
